import { getRoomListAPI } from "../../../apis/room";

Page({
  data: {
    dialogVisible: false,
    roomList: []

  },
  async onLoad() {
    const res = await getRoomListAPI()
    this.setData({
      roomList: res.data
    })
  },


  swipeClose(ev) {
    const { position, instance } = ev.detail

    if (position === 'right') {
      // 显示 Dialog 对话框
      this.setData({
        dialogVisible: true,
      })

      // swiper-cell 滑块关闭
      instance.close()
    }
  },

  goDetail(val) {
    wx.navigateTo({
      url: '/house_pkg/pages/detail/index?id=' + val.mark.id,
    })
  },

  addHouse() {
    wx.navigateTo({
      url: '/house_pkg/pages/locate/index',
    })
  },
})
